//
// Created by 86138 on 2025/6/7.
//

#ifndef QINGDAO_UNIVERSITY_CIRCULARLINKLIST_H
#define QINGDAO_UNIVERSITY_CIRCULARLINKLIST_H
#include "../01-intro/c1-1.h"

namespace sweetcookie {
    typedef int ElemType;

    typedef struct LNode {
        ElemType data;
        struct LNode *next;
    } LNode;

    typedef LNode* CircularLinkList; // 另一种选择是定义struct CircularLinkList，包括尾指针成员

    void InitList(CircularLinkList &L);

    void ClearList(CircularLinkList &L);

    void DestroyList(CircularLinkList &L);

    Status ListEmpty(CircularLinkList L);

    int ListLength(CircularLinkList L);

    Status ListInsert(CircularLinkList &L, int i, ElemType e);

    Status ListDelete(CircularLinkList &L, int i, ElemType &e);

    void ListTraverse(CircularLinkList L);

    void ListMerge(CircularLinkList &La, CircularLinkList &Lb);
}
#endif //QINGDAO_UNIVERSITY_CIRCULARLINKLIST_H
